{include file="public/nheader" /}
<div class="layui-fluid layui-bg-white">
  <form action="{:url()}" class="layui-form layui-form-fixed">
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>参数名称
      </label>
      <div class="layui-input-block">
        <input type="text" required="" lay-verify="required" autocomplete="off" class="layui-input"
          value="{$row.remark|default=''}" placeholder="" disabled>
      </div>
    </div>
    {if !empty($row.name) && ($row.name == 'laiyuan' || $row.name == 'tags')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>选项
      </label>
      <div class="layui-input-block">
        {if !empty($laiyuan) && count($laiyuan) > 0}
        {foreach $laiyuan as $list}
        <input type="checkbox" name="value[]" value="{$list}" title="{$list}" {if !empty($row['value']) &&
          is_array($row['value']) && count($row['value'])> 0 && in_array($list,$row['value'])}checked{/if}>
        {/foreach}
        {else}
        无
        {/if}
        <div style="color: red;">勾选表示有效，取消勾选表示无效</div>
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'leimu')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>已有类目(不可删除)
      </label>
      <div class="layui-input-block">
        {if !empty($row['value']) && count($row['value']) > 0}
        {foreach $row['value'] as $k=> $list}
        {$k}、<input style="display: inline-block;width: 200px;" type="text" name="value[{$k}]" value="{$list}"
          class="layui-input">(更改名称会变更已添加的品牌类目名称)
        <br />
        {/foreach}
        {else}
        <input type="text" class="layui-input" value="暂无类目" disabled> {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        添加新类目
      </label>
      <div class="layui-input-block">
        <input type="text" name="value1" class="layui-input">
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'drtime')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        日期范围
      </label>
      <div class="layui-input-block">
        <input type="text" name="value[0]" value="{$row.value[0]|default=''}" class="layui-input"
          style="display: inline-block;width: 200px;">-
        <input type="text" name="value[1]" value="{$row.value[1]|default=''}" class="layui-input"
          style="display: inline-block;width: 200px;">天前
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'fuzhinumber')}
    <div class="layui-form-item" style="display: none;">
      <label class="layui-form-label">
        <font color="red">* </font>数量
      </label>
      <div class="layui-input-block">
        <input type="number" id="name" name="value[fuzhinumber]" required="" lay-verify="required" autocomplete="off"
          class="layui-input" value="{$row.value.fuzhinumber|default='0'}" placeholder="">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>跑动品牌
      </label>
      <div class="layui-input-block">
        {if !empty($pinpai) && count($pinpai) > 0}
        {foreach $pinpai as $list}
        <input type="checkbox" name="value[pbpp][]" value="{$list.type}" title="{$list.pinpai}" {if
          !empty($row['value']['pbpp']) && is_array($row['value']['pbpp']) && count($row['value']['pbpp'])> 0 &&
        in_array($list.type,$row['value']['pbpp'])}checked{/if}>
        {/foreach}
        {else}
        无
        {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>跑动省份(不选表示跑全部)
      </label>
      <div class="layui-input-block">
        {if !empty($provincelist) && count($provincelist) > 0}
        {foreach $provincelist as $list}
        <input type="checkbox" name="value[provincelist][]" value="{$list}" title="{$list}" {if
          !empty($row['value']['provincelist']) && is_array($row['value']['provincelist']) &&
          count($row['value']['provincelist'])> 0 &&
        in_array($list,$row['value']['provincelist'])}checked{/if}>
        {/foreach}
        {else}
        无
        {/if}
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>日有效数量
      </label>
      <div class="layui-input-block">
        <input type="number" id="value[youxiao]" name="value[youxiao]" value="{$row.value.youxiao|default='0'}"
          required="" lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>日无效数量
      </label>
      <div class="layui-input-block">
        <input type="number" id="value[wuxiao]" name="value[wuxiao]" value="{$row.value.wuxiao|default='0'}" required=""
          lay-verify="required" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>导入日期
      </label>
      <div class="layui-input-block">
        <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
          style="width: 150px;display: inline-block;" id="value[daterangestar]" name="value[daterangestar]"
          value="{$row.value.daterangestar|default=''}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">日至
        <input type="text" lay-datetime="" data-format="yyyy-MM-dd" data-type="date"
          style="width: 150px;display: inline-block;" id="daterangeend" name="value[daterangeend]"
          value="{$row.value.daterangeend|default=''}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">日
        <div style="color:red">含起始日期当天，不含结束日期当天。如果起始日期和结束日期均低于运行日期品牌自动导入功能自动关闭</div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>资源日期范围
      </label>
      <div class="layui-input-block">
        <input type="number" style="width: 150px;display: inline-block;" id="value[datebefore]" name="value[datebefore]"
          value="{$row.value.datebefore|default='0'}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">至
        <input type="number" style="width: 150px;display: inline-block;" id="value[dateafter]" name="value[dateafter]"
          value="{$row.value.dateafter|default='0'}" required="" lay-verify="required" autocomplete="off"
          class="layui-input">天前
        <div style="color:red">如果存在一个数据是0，默认使用系统配置内数据</div>
      </div>
    </div>
    {else}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>内容
      </label>
      <div class="layui-input-block">
        <input type="text" id="name" name="value" required="" lay-verify="required" autocomplete="off"
          class="layui-input" value="{$row.value|default=''}" placeholder="">
      </div>
    </div>
    {/if}
    <div class="layui-footer layui-form-item layui-center ">
      <input type="hidden" value="{$row['name']|default=''}" name="name" />
      <button class="layui-btn" lay-filter="submitIframe" type="button" lay-submit>提交</button>
      <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">取消</button>
    </div>
  </form>
</div>
{include file="public/nfooter" /}
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script>
  layui.use(['form', 'jquery', 'admin', 'content'], function () {
    var form = layui.form;
    var admin = layui.admin;
    var jquery = layui.jquery;

    // 渲染富文本编辑器
    var content = layui.content;
    content.tinymce('value');
  });
  function addtable2() {
    var i = $('#table2 tbody tr').length;
    //你要添加的html
    var html = '<tr>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][getmoney]" value=""></td>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][money]" value=""></td>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][days]" value=""></td>' +
      '<td><a class="layui-btn layui-btn-danger layui-btn-xs del2" >删除</a></td></tr>';
    $(html).appendTo($('#table2 tbody:last'));
    layui.use(['form'], function () {
      $ = layui.jquery;
      var form = layui.form;
      form.render();
    });
  };
  $('body').on('click', '.del2', function () {
    $(this).closest('tr').remove();
  });
</script>